package com.cqrt.config;

import java.util.regex.Pattern;

public class NameValidator {

    // 定义允许的字符模式，可以根据实际需求调整
    private static final Pattern VALID_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9\u4e00-\u9fa5\\s]+$");

    public static boolean isNameValid(String name) {
        // 检查是否为空
        if (name == null || name.trim().isEmpty()) {
            return false;
        }
        // 检查是否包含非法字符
        return VALID_NAME_PATTERN.matcher(name).matches();
    }


}